<template>
  <div class="hitAlbumBox">
    <p class="tit">Ta的其他热门专辑</p>
    <ul>
      <router-link
        tag="li"
        :to="{ name: 'album', query: { id: item.id, uid: $route.query.uid } }"
        class="hitAlbumItem"
        v-for="item in albumArr"
        :key="item.id"
      >
        <img class="itemImg" :src="item.picUrl" alt="" />
        <div>
          <p class="itemName">{{ item.name }}</p>
          <p class="itemTime">{{ item.publishTime | fmtDate("yyyy-MM-DD") }}</p>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
import { getAlbum } from "@/api";
export default {
  data() {
    return {
      albumArr: [],
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      getAlbum({ id: this.$route.query.uid, limit: 5 }).then((res) => {
        this.albumArr = res.hotAlbums;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.hitAlbumBox {
  .tit {
    color: #333;
    height: 23px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
    font-weight: 700;
  }
  .hitAlbumItem {
    cursor: pointer;
    display: flex;
    margin: 10px 0;
    img {
      width: 50px;
      height: 50px;
      margin-right: 10px;
    }
    div {
      flex: 1;
      overflow: hidden;
      .itemName {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 24px;
        white-space: nowrap;
      }
      .itemTime {
        font-size: 12px;
        line-height: 24px;
        color: #666;
      }
    }
  }
}
</style>